package com.hwd.gmall.model.enums;

/**
 * 订单状态枚举类
 *
 * @author Victor
 */

public enum OrderStatus {

    /**
     * 订单状态，未支付
     */
    UNPAID("未支付"),

    /**
     * 订单状态，已支付
     */
    PAID("已支付"),

    /**
     * 订单状态，超时取消订单
     */
    TIMEOUT("超时取消订单"),

    /**
     * 订单状态，主动取消订单
     */
    CANCEL("主动取消订单"),

    /**
     * 订单状态，待发货
     */
    WAITING_DELIVER("待发货"),

    /**
     * 订单状态，已发货
     */
    DELIVERED("已发货"),

    /**
     * 订单状态，已关闭
     */
    CLOSED("已关闭"),

    /**
     * 订单状态，已完结
     */
    FINISHED("已完结"),

    /**
     * 订单状态，订单已拆分
     */
    SPLIT("订单已拆分");

    private String comment;

    public static String getStatusNameByStatus(String status) {
        OrderStatus[] arrObj = OrderStatus.values();
        for (OrderStatus obj : arrObj) {
            if (obj.name().equals(status)) {
                return obj.getComment();
            }
        }
        return "";
    }

    OrderStatus(String comment) {
        this.comment = comment;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }
}
